﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SerializedData
{
    /// <summary>
    /// Represents a Sensor.
    /// </summary>
    [Serializable()]
    public class SSensor
    {
        private String mName;
        private String mUdp;
        private String mDescription;
        private long mRefState = -1;
        private long mId;

        public SSensor(long id, String name, String udp, String description)
        {
            mDescription = description;
            mName = name;
            mUdp = udp;
            mId = id;
        }

        public String getName()
        {
            return mName;
        }

        public long getId()
        {
            return mId;
        }

        public String getUdp()
        {
            return mUdp;
        }
        public void setName(String name)
        {
            mName = name;
        }

        public void setUdp(String udp)
        {
            mUdp = udp;
        }

        public long getRefState()
        {
            DataCollection dc = DataCollection.Instance;
            if(dc.getStatePool().Find(o => o.getId().Equals(mRefState))==null)
                mRefState = -1;
            return mRefState;
        }

        public void setRefState(long state)
        {
            mRefState = state;
        }
      
        

    }
}
